/*
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *    2012 year
 *    Author: Michael Khromov aka MikeDM (Mike D'Morto)
 *    E-Mail: mikedmorto@gmail.com
 */

#ifndef XSERVER_H
#define XSERVER_H

#define MOD_NAME "xml-rpc"

#include <QObject>
#include "server.h"
#include "iDatabases.h"

class Xserver : public QObject
{
    Q_OBJECT
    xmlrpc::Server * server;
    int port;
    iDatabase * idb;
    // карта сессий наименование сессии и штамп времени последней активности
    QMap<QString,QDateTime> sessions;

public:
    explicit Xserver(int port, iDatabase * idb, QObject *parent = 0);
    bool start();
    
signals:
    void sigPutLog(const QString & owner, int level, const QString & text);
public slots:
private slots:
    // слоты для работы xml-rpc
    void slotProcessRequest( int id, QString methodName, QList<xmlrpc::Variant> parameters);
    void slotIncomingConnectionIp(QString name, QString ip, QString port);
    
};

#endif // XSERVER_H
